package com.spsm.netlab;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

import com.spsm.netlab.blocks.HCRouter;
import com.spsm.netlab.blocks.MCRouter;
import com.spsm.netlab.blocks.QuantumRouter;
import com.spsm.netlab.blocks.attackLauncher;
import com.spsm.netlab.blocks.circuitAssembler;
import com.spsm.netlab.blocks.networkExtender;
import com.spsm.netlab.blocks.quantumServerBank;
import com.spsm.netlab.blocks.router;
import com.spsm.netlab.blocks.serverBank;
import com.spsm.netlab.blocks.xomuyniteOre;
import com.spsm.netlab.items.backpack;
import com.spsm.netlab.items.blankCircuitBoard;
import com.spsm.netlab.items.solderingIron;
import com.spsm.netlab.items.speedTester;
import com.spsm.netlab.items.xomuniteGem;
import com.spsm.netlab.packethandling.PacketPipeline;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = NetLab.MODID, version = NetLab.VERSION)

public class NetLab
{
    public static final String MODID = "netlab";
    public static final String VERSION = "1.7.2-0.1.8.1";
    
    public static CreativeTabs netLabTab = new CreativeTabs("NetLab"){
		public Item getTabIconItem() {
			return Item.getItemFromBlock(NetLab.serverBank);
		}
    	
    };
    
    //Declaring packet stuff.
    public static final PacketPipeline packetPipeline = new PacketPipeline();

    
    //Declaring blocks
    public static Block QuantumRouter;
    public static Block HCrouter;
    public static Block MCrouter;
    public static Block router;
    public static Block circuitAssembler;
    public static Block serverBank;
    public static Block quantumServerBank;
    public static Block networkExtender;
    public static Block quantumMaterializer;
    public static Block attackLauncher;
    
    //Declaring ore blocks
    public static Block xomuyniteOre;

    //Declaring items
    public static Item solderingIron;
    public static Item blankCircuitBoard;
    public static Item speedTester;
    public static Item backpack;
    public static Item xomuniteGem;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event){
    	//Adding blocks
    	HCrouter = new HCRouter().setBlockName("HCrouter");
    	GameRegistry.registerBlock(HCrouter, HCrouter.getUnlocalizedName());
    	
    	MCrouter = new MCRouter().setBlockName("MCrouter");
    	GameRegistry.registerBlock(MCrouter, MCrouter.getUnlocalizedName());
    	
    	router = new router().setBlockName("router");
    	GameRegistry.registerBlock(router, router.getUnlocalizedName());
    	
    	QuantumRouter = new QuantumRouter().setBlockName("QuantumRouter");
    	GameRegistry.registerBlock(QuantumRouter, QuantumRouter.getUnlocalizedName());
    	
    	circuitAssembler = new circuitAssembler().setBlockName("circuitAssembler");
    	GameRegistry.registerBlock(circuitAssembler, circuitAssembler.getUnlocalizedName());
    	
    	serverBank = new serverBank().setBlockName("serverBank");
    	GameRegistry.registerBlock(serverBank, serverBank.getUnlocalizedName());
    	
    	quantumServerBank = new quantumServerBank().setBlockName("quantumServerBank");
    	GameRegistry.registerBlock(quantumServerBank, quantumServerBank.getUnlocalizedName());
    
    	networkExtender = new networkExtender().setBlockName("networkExtender");
    	GameRegistry.registerBlock(networkExtender, networkExtender.getUnlocalizedName());
    	
    	attackLauncher = new attackLauncher().setBlockName("attackLauncher");
    	GameRegistry.registerBlock(attackLauncher, attackLauncher.getUnlocalizedName());
    	
    	//Adding ores
    	xomuyniteOre = new xomuyniteOre().setBlockName("xomuyniteOre").setBlockTextureName(MODID + ":" + "xomuniteOre");
    	GameRegistry.registerBlock(xomuyniteOre, xomuyniteOre.getUnlocalizedName());
    	
    	//Adding items
    	solderingIron = new solderingIron().setUnlocalizedName("solderingIron").setTextureName(NetLab.MODID + ":" + "solderingIron");
    	GameRegistry.registerItem(solderingIron, solderingIron.getUnlocalizedName().substring(5));
    	
    	blankCircuitBoard = new blankCircuitBoard().setUnlocalizedName("blankCircuitBoard").setTextureName(NetLab.MODID + ":" + "blankCircuitBoard");
    	GameRegistry.registerItem(blankCircuitBoard, blankCircuitBoard.getUnlocalizedName().substring(5));
    	
    	speedTester = new speedTester().setUnlocalizedName("speedTester").setTextureName(NetLab.MODID + ":" + "speedTester");
    	GameRegistry.registerItem(speedTester, speedTester.getUnlocalizedName().substring(5));
    	
    	backpack = new backpack().setUnlocalizedName("backpack").setTextureName(NetLab.MODID + ":" + "backpack");
    	GameRegistry.registerItem(backpack, backpack.getUnlocalizedName().substring(5));
    	
       	xomuniteGem = new xomuniteGem().setUnlocalizedName("xomuniteGem").setTextureName(NetLab.MODID + ":" + "xomuniteGem");
    	GameRegistry.registerItem(xomuniteGem, xomuniteGem.getUnlocalizedName().substring(5));
    	
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	packetPipeline.initalise();

    }
    
    public void postInit(FMLPostInitializationEvent event)
    {
    	packetPipeline.postInitialise();
    }
}
